<?php /* D:\phpStudy\PHPTutorial\WWW\laravel-admin\resources\views/admin/systermAd/add.blade.php */ ?>
<div id="app">
    <section class="content-header">
        <h1>
            <small>轮播图添加</small>
        </h1>

    </section>

    <section class="content">
        <div class="row">
            <div class="col-md-12">
                <div class="box box-info">
                    <div class="box-header with-border">


                        <div class="box-tools">
                            <div class="btn-group pull-right" style="margin-right: 5px">
                                <a href="/admin/lunbo/index" class="btn btn-sm btn-default" title="轮播图列表"><i class="fa fa-list"></i><span class="hidden-xs">&nbsp;轮播图列表</span></a>
                            </div>
                        </div>
  <span>
    <a class="btn btn-sm btn-primary grid-refresh" title="刷新"><i class="fa fa-refresh"></i><span class="hidden-xs"> 刷新</span></a>
    <a class="btn btn-sm btn-primary" onclick="javascript:history.go(-1);" title="返回"> <span class="hidden-xs"> 返回</span></a>
  </span>
                    </div>
                    <!-- /.box-header -->
                    <!-- form start -->
                    <form id="addForm" action="/admin/lunbo/add" method="post" accept-charset="UTF-8" class="form-horizontal" enctype="multipart/form-data" pjax-container>
                        <div class="box-body">
                            <div class="fields-group">

                                <div class="form-group  ">
                                    <label for="cate_name" class="col-sm-2  control-label">渠道</label>
                                    <div class="col-sm-8">

                                            <select name="cha_id" class="form-control">
                                                <?php if($channel): ?>
                                                    <?php $__currentLoopData = $channel; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $k=>$v): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <option value="<?php echo e($k, false); ?>"><?php echo e($v, false); ?></option>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                <?php endif; ?>
                                            </select>

                                    </div>
                                </div>

                                <div class="form-group  ">
                                    <label for="cate_name" class="col-sm-2  control-label">描述 </label>
                                    <div class="col-sm-8">
                                        <div class="input-group">
                                            <span class="input-group-addon"><i class="fa fa-pencil fa-fw"></i></span>
                                            <input type="text" id="title" name="title" value="" class="form-control"  />
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group  ">
                                    <label for="cate_name" class="col-sm-2  control-label">跳转地址 </label>
                                    <div class="col-sm-8">
                                        <div class="input-group">
                                            <span class="input-group-addon"><i class="fa fa-pencil fa-fw"></i></span>
                                            <input type="text" id="content_url" name="content_url" value="" class="form-control"  />
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group  ">
                                    <label for="is_official_auth" class="col-sm-2  control-label">是否显示</label>
                                    <div class="col-sm-8">
                                        <label class="radio-inline">
                                            <input type="radio" name="is_show_share" value="0" class="minimal is_show_share"   />&nbsp;否&nbsp;&nbsp;
                                        </label>
                                        <label class="radio-inline">
                                            <input type="radio" name="is_show_share" value="1" class="minimal is_show_share" checked  />&nbsp;是&nbsp;&nbsp;
                                        </label>
                                    </div>
                                </div>

                                <div class="form-group  ">
                                    <label for="img" class="col-sm-2  control-label">图片</label>
                                    <div class="col-sm-8">
                                        <input type="file" class="litpic" name="litpic"  />
                                    </div>
                                </div>

                            </div>
                        </div>
                        <!-- /.box-body -->

                        <div class="box-footer">
                            <?php echo csrf_field(); ?>
                            <div class="col-md-2">
                            </div>
                            <div class="col-md-8">
                                <div class="btn-group pull-right">
                                    <button type="button" onclick="tijiao()" class="btn btn-primary">添加</button>
                                </div>

                                <div class="btn-group pull-left">
                                    <button type="reset" class="btn btn-warning">重置</button>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>

            </div></div>
    </section>
</div>
<script data-exec-on-popstate>
    $(function () {
        $("input.litpic").fileinput({"overwriteInitial":true,"initialPreviewAsData":true,"browseLabel":"\u6d4f\u89c8","showRemove":false,"showUpload":false,"dropZoneEnabled":false,"deleteExtraData":{"goods_img_list":"_file_del_","_file_del_":"","_token":"Kq6b1qbgSwE02ACOgZOsO9QeD99PSWROQgk10d1w","_method":"PUT"},"deleteUrl":"http:\/\/www.laras.com\/admin\/goods\/","allowedFileTypes":["image"]});

        //刷新
        $('.grid-refresh').on('click', function() {
            $.pjax.reload('#pjax-container');
            toastr.success('刷新成功 !');
        });

    });


    function tijiao(){
        var data=new FormData($("#addForm")[0]);
        $.ajax({
            url:"/admin/lunbo/add",
            type:'post',
            data:data,
            dataType:'json',
            processData: false,
            contentType: false,
            success:function(m){
                if(m.status==1){
                    toastr.success(m.message);
                    window.location.href='/admin/lunbo/index';
                }else{
                    swal(m.message, '', 'error');
                }
            }
        });
    }
</script>